/*
* FILENAME:		stack_app.h
* CREATED AT:		2012/Jun/4
* DECRITION:		
* 
* MODULE:		stack
* PLATFORM:		ubuntu-12.04/gcc-4.6.3
* AUTHOR:		incarnation-lee
* 
* ----------------------REVISION HISTROY------------------------
* No.	Date	Revised by	Function	Descrition
* 1	12/5/28	incar-lee	NA		
*
*/

#ifndef STACK_APP_H
#define STACK_APP_H

#include <stddef.h>
#include "udgtd.h"


#define isMatch(x,y)	(((x)==40 && (y)==41)?1:(((x)==91 && (y)==93)?1:0))

#define COLOR_BIT(x,n)	((x)|(1<<(n)))


STATUS stack_app_demo(void);		/* the main control function */
STATUS stack_convert(void);		/* the Hex convert from DEC to OCT */
STATUS stack_match(void);		/* Matching the parenthesis */
STATUS stack_ledit(void);		/* line editer */
STATUS stack_detect(void);		/* maze path detect */
static STATUS loc_next(S_sqstack*,S_element*);	/* find the next location */
STATUS stack_expression();		/* get the value of expression */
signed int operate(int,int,char)__attribute((pure));	/* operate expression */


/* operation functions defined in stack_seq.c */
extern STATUS init_sqk(S_sqstack*);				/* initiliazie a sequence stack */
extern STATUS destory_sqk(S_sqstack*);				/* stack exits */
extern STATUS clear_sqk(S_sqstack*);				/* stack exits */
extern STATUS isEmpty_sqk(S_sqstack*);				/* if stack exit and empty */
extern size_t length_sqk(S_sqstack*);				/* stack exits return length */
extern S_element *top_sqk(S_sqstack*);				/* stack exits return top elements */
extern STATUS push_sqk(S_sqstack*,S_element*);			/* push a elemen on the exited stack */
extern STATUS pop_sqk(S_sqstack*,S_element*);			/* pop a elemen on the exited stack */
extern STATUS isContain_sqk(S_sqstack*,S_element*);		/* if a element in stack */

#endif
